﻿<%@ Page Title="" Language="C#" MasterPageFile="~/W_View/PageMaster.Master" AutoEventWireup="true" CodeBehind="DnTrafficWayPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Needs.DnTrafficWayPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>

    <script>
        function diviResultDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/DnTrafficWay");
        }
        //计算剩余寿命
        function js() {
            if ($('#zzl').textbox("isValid")) {
                $.messager.progress({
                    title: '请等待',
                    msg: '正在处理中...'
                });

                var rdid = $('#cmbRoadway').combobox('getValue'); //路线编号
                var zzl = $('#zzl').numberbox('getValue');//年增长率

                $.ajax({
                    url: "/api/DnTrafficWay/calculate?rdid=" + rdid + "&zzl=" + zzl,
                    type: "post",
                    complete: function () {
                        $.messager.progress('close');
                    },
                    success: function (msg) {
                        search(null, null);
                    },

                    error: function (msg) {
                        $.messager.alert('错误提示', msg.responseText, "error");
                    }
                });
            }
        }

        //查询
        function mysearch() {
            search(null, null);
        }

        $(function () {

            var url = null;

            var number = '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            dataGridBind($('#dg'), url, '养护路段划分列表显示', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });

        })

        function search(n, o) {
            var rdid = $('#cmbRoadway').combobox('getValue'); //路线
            var url = '/api/DnTrafficWay?';
            var urlParam = "";
            if (rdid != "") urlParam += "rdid=" + encodeURI(rdid);
            url = url + urlParam;
            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table id="dg" class="easyui-datagrid content-place" ajaxcached="false">
        <thead>
            <tr>
                <th data-options="field:'Segid',width:120">路段编号</th>
                <th data-options="field:'Svydata',width:120" formatter='formatDate'>调查日期</th>
                <th data-options="field:'Accuequ_Load',width:180">累计当量轴载(设计年限内)</th>
                <th data-options="field:'Easl',width:180">累计当量轴载(通车至今)</th>
                <th data-options="field:'Rl',width:120">剩余寿命(年)</th>

            </tr>
        </thead>
    </table>
    <div id="tb">
        路线名称:
        <select id="cmbRoadway" class="easyui-combobox" panelheight="80" style="width: 100px"
            data-options="url:'/api/S_Inspeaccse/RoadWay',method:'get',valueField:'Rdwayid',textField:'Name',
                            onLoadSuccess:function(data){ $('#cmbRoadway').combobox('setValue',data[0].Rdwayid);}">
        </select>

        年增长率(%):<input id="zzl" class="easyui-validatebox easyui-numberbox" data-options="min:1,max:70,required:true" missingmessage="年增长率必须填写" panelheight="80" style="width: 100px" />

        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="mysearch()">查询</a>

        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="diviResultDel()">删除</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="js()">计算剩余寿命</a>

    </div>
</asp:Content>
